package ru.spbu.mm.diploma.server.dao;

import org.hibernate.annotations.NamedQueries;
import org.hibernate.annotations.NamedQuery;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
import ru.spbu.mm.diploma.common.entity.Risk;

import javax.persistence.Query;
import java.util.List;

/**
 * Created by IntelliJ IDEA.
 * User: Ksushenka
 * Date: 29.10.11
 * Time: 18:26
 * To change this template use File | Settings | File Templates.
 */

public class RiskDAOImpl extends HibernateDaoSupport implements IRiskDAO{
    public List<Risk> getAllRisk() {
        return null;
    }

    public Risk getByName(String name) {
        return (Risk) this.getHibernateTemplate().findByNamedQueryAndNamedParam("findByName", "riskName", name).get(0);
    }


    public List<Risk> getRisksByGroupId(Integer id) {
        return (List<Risk>)this.getHibernateTemplate().findByNamedQueryAndNamedParam("findRiskByRiskGroup", "groupId", id);

    }
}
